package cn.muqingfeng.api.to;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;

public class BaseArticle2TO implements Parcelable {

	@SerializedName("data")
	private ArticleData2 data;

	public BaseArticle2TO() {
	}

	public BaseArticle2TO(Parcel source) {
		this.data = source.readParcelable(ArticleData2.class.getClassLoader());
	}

	public ArticleList2TO getArticleListTO() {
		if (data != null) {
			return data.getListTO();
		}
		return null;
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeParcelable(data, flags);
	}

	public static final Creator<BaseArticle2TO> CREATOR = new Creator<BaseArticle2TO>() {

		@Override
		public BaseArticle2TO[] newArray(int size) {
			return new BaseArticle2TO[size];
		}

		@Override
		public BaseArticle2TO createFromParcel(Parcel source) {
			return new BaseArticle2TO(source);
		}
	};

	public ArticleData2 getData() {
		return data;
	}

	public void setData(ArticleData2 data) {
		this.data = data;
	}

	public String toGsonString() {
		Gson gson = new Gson();
		return gson.toJson(this);
	}

}
